extern sys_call_table

_NR_DISP_STR_	equ	1
_SYSCALL_INT_	equ 0x80

global _NR_DISP_STR_
global _SYSCALL_INT_
global print_str
global cls
global sys_call
global kill_me
	;系统调用入口
sys_call:
		push ebx
		xor ebx,ebx
		mov bx,ds
		push ebx
		mov bx,es
		push ebx

		mov bx,0x10
		mov ds,bx
		mov es,bx

		call [sys_call_table + eax * 4]
		
		pop ebx
		mov es,bx
		pop ebx
		mov ds,bx
		pop ebx
		iret
		
;print_str函数，其实是int 0x80中断的封装
print_str:
	push ebp
	mov ebp,esp
	push esi
	mov esi,[ebp + 8]
	push eax
	
	mov eax,1
	int 0x80

	pop eax
	pop esi
	pop ebp
	
	ret
	
cls:
	push ebp
	mov ebp,esp
	push esi
	mov esi,[ebp + 8]
	push eax
	
	mov eax,2
	int 0x80

	pop eax
	pop esi
	pop ebp
	
	ret

;Kill me please!
kill_me:
	push ebp
	mov ebp,esp
	push esi
	mov esi,[ebp + 8]
	push eax
	
	mov eax,3
	int 0x80

	pop eax
	pop esi
	pop ebp
	
	ret
